import request from '@/utils/request'

// 查询药剂清单列表
export function listPharmaceuticalList(params) {
  return request({
    url: '/operation/web/operationPharmaceuticalList/list',
    method: 'get',
    params
  })
}

// 获取药剂采购下拉列表
export function getPurchaseList() {
  return request({
    url: '/operation/web/operationPharmaceuticalList/purchaseList',
    method: 'get'
  })
}

// 获取药剂清单详细信息
export function getPharmaceuticalDetail(id) {
  return request({
    url: `/operation/web/operationPharmaceuticalList/${id}`,
    method: 'get'
  })
}

// 查询出入库记录
export function getInOutRecord(id) {
  return request({
    url: `/operation/web/operationPharmaceuticalList/inOutRecord/${id}`,
    method: 'get'
  })
}

// 查询使用登记记录
export function getUseRecord(id) {
  return request({
    url: `/operation/web/operationPharmaceuticalList/useRecord/${id}`,
    method: 'get'
  })
}

// 新增药剂清单
export function addPharmaceuticalList(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalList',
    method: 'post',
    data
  })
}

// 修改药剂清单
export function updatePharmaceuticalList(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalList',
    method: 'put',
    data
  })
}

// 删除药剂清单
export function deletePharmaceuticalList(ids) {
  return request({
    url: `/operation/web/operationPharmaceuticalList/${ids}`,
    method: 'delete'
  })
}

// 入库
export function stockIn(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalList/inLibrary',
    method: 'post',
    data
  })
}

// 出库
export function stockOut(params) {
  return request({
    url: '/operation/web/operationPharmaceuticalList/outLibrary',
    method: 'get',
    params
  })
}

// 使用登记
export function useRegister(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalList/use',
    method: 'put',
    data
  })
}

// 药剂类型下拉列表
export function getDrugTypeList() {
  return request({
    url: '/operation/web/operationPharmaceuticalList/type/options',
    method: 'get'
  })
}

